# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pinentry-ui
pkgver=1.1.0
pkgrel=1
pkgdesc="Graphical UI's for Pinentry"
url="http://www.gnupg.org/aegypten2"
arch="all"
license="GPL-2.0-or-later"
makedepends="libcap-dev gtk+-dev libgpg-error-dev libassuan-dev
	gcr-dev libsecret-dev qt5-qtbase-dev"
subpackages="pinentry-gtk pinentry-gnome pinentry-qt"
source="ftp://ftp.gnupg.org/gcrypt/pinentry/pinentry-$pkgver.tar.bz2"
builddir="$srcdir/pinentry-$pkgver"

build () {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-pinentry-gtk \
		--enable-pinentry-gtk2 \
		--enable-pinentry-qt \
		--disable-pinentry-curses \
		--disable-fallback-curses \
		--enable-pinentry-gnome3 \
		--enable-libsecret
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	# created by post install scripts so we can override with other UI versions
	rm -f "$pkgdir"/usr/bin/pinentry
}

gtk() {
	install="pinentry-gtk.post-install pinentry-gtk.post-deinstall"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/pinentry-gtk* \
		"$subpkgdir"/usr/bin/
}

gnome() {
	depends="gcr"
	install="pinentry-gnome.post-install pinentry-gnome.post-deinstall"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/pinentry-gnome3 \
		"$subpkgdir"/usr/bin/
}

qt() {
	install="pinentry-qt.post-install pinentry-qt.post-deinstall"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/pinentry-qt* \
		"$subpkgdir"/usr/bin/
}

sha512sums="5012672925bcb5f683358c259e55e4b87c67cf063ad52c759308933733025c33f7ce08e5b8019ffc101cbf7ef30499040ef2fd34a7611698e65e1593f80948cd  pinentry-1.1.0.tar.bz2"
